<?php

/**
 * rmUserCompetence form base class.
 *
 * @method rmUserCompetence getObject() Returns the current form's model object
 *
 * @package    ressourceManager
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasermUserCompetenceForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_user_competence' => new sfWidgetFormInputHidden(),
      'id_user'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('idUser'), 'add_empty' => false)),
      'id_competence'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('idCompetence'), 'add_empty' => false)),
      'user_level'         => new sfWidgetFormChoice(array('choices' => array(1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5'))),
    ));

    $this->setValidators(array(
      'id_user_competence' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id_user_competence')), 'empty_value' => $this->getObject()->get('id_user_competence'), 'required' => false)),
      'id_user'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('idUser'))),
      'id_competence'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('idCompetence'))),
      'user_level'         => new sfValidatorChoice(array('choices' => array(0 => '1', 1 => '2', 2 => '3', 3 => '4', 4 => '5'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('rm_user_competence[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'rmUserCompetence';
  }

}
